<?php

/**
 * DiscussionMember form base class.
 *
 * @method DiscussionMember getObject() Returns the current form's model object
 *
 * @package    ecollegeplus
 * @subpackage form
 * @author     Batanayi Matuku
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDiscussionMemberForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                      => new sfWidgetFormInputHidden(),
      'nickname'                => new sfWidgetFormInputText(),
      'subscription_type'       => new sfWidgetFormInputText(),
      'membership_type'         => new sfWidgetFormInputText(),
      'posting_permission_type' => new sfWidgetFormInputText(),
      'status'                  => new sfWidgetFormInputText(),
      'discussion_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Discussion'), 'add_empty' => false)),
      'user_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'is_removed'              => new sfWidgetFormInputCheckbox(),
      'created_at'              => new sfWidgetFormDateTime(),
      'updated_at'              => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                      => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nickname'                => new sfValidatorString(array('max_length' => 255)),
      'subscription_type'       => new sfValidatorInteger(array('required' => false)),
      'membership_type'         => new sfValidatorInteger(array('required' => false)),
      'posting_permission_type' => new sfValidatorInteger(array('required' => false)),
      'status'                  => new sfValidatorInteger(array('required' => false)),
      'discussion_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Discussion'))),
      'user_id'                 => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
      'is_removed'              => new sfValidatorBoolean(array('required' => false)),
      'created_at'              => new sfValidatorDateTime(),
      'updated_at'              => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('discussion_member[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DiscussionMember';
  }

}
